'use strict';

module.exports = app => {
  const { router, controller: { role }, middleware: { validator, checkPageTable, checkParams } } = app;
  // const userExist = app.middleware.userExist();
  const baseUrl = '/api/role';
  router.get(baseUrl + '/all', role.all);
  router.get(baseUrl, checkPageTable(), role.index);
  router.get(baseUrl + '/:id', checkParams(), role.show);
  router.post(baseUrl, validator('role.create'), role.create);
  router.put(baseUrl + '/:id', checkParams(), validator('role.update'), role.update);
  router.delete(baseUrl + '/:id', checkParams(), role.destroy);
};
